package main

import (
	"fmt"
	"strings"
	"unicode"
)

func mostCommonWord(paragraph string, banned []string) string {

	f := func(c rune) bool { return !unicode.IsLetter(c) && !unicode.IsNumber(c) }
	strSlice := strings.FieldsFunc(paragraph, f)
	strs := make(map[string]int)
	for _, v := range strSlice {
		strs[strings.ToLower(v)]++
	}
	maxCont := 0
	result := ""
	for k, c := range strs {
		for i := 0; i < len(banned); i++ {
			if k == banned[i] {
				goto Look
			}
		}
		if c > maxCont {
			result, maxCont = k, c
		}
	Look:
	}
	return result

}

func main() {
	paragraph := "Bob hit a ball, the hit BALL flew far after it was hit."
	banned := []string{"hit"}

	fmt.Println(mostCommonWord(paragraph, banned))

}
